package top.meeting.room.common.factory;

import com.jfinal.json.FastJson;
import com.jfinal.json.Json;
import com.jfinal.json.MixedJsonFactory;


/**
 * 我有故事，你有酒么？
 * JKhaled created by yunqisong@foxmail.com 2017/7/23
 * FOR : 重写JsonFoctory
 */
public class JKhaledMixedJsonFactory extends MixedJsonFactory{


    private static final JKhaledMixedJsonFactory me = new JKhaledMixedJsonFactory();

    public static JKhaledMixedJsonFactory me() {
        return me;
    }

    private static JKhaledMixedJson mixedJson =  new JKhaledMixedJson();

    public Json getJson() {
        return mixedJson;
    }

    private static class JKhaledMixedJson extends Json {
        private static JKhaledJson jKhaledJson = JKhaledJson.getJson();
        private static FastJson fastJson = FastJson.getJson();

        public String toJson(Object object) {
            return jKhaledJson.toJson(object);
        }

        public <T> T parse(String jsonString, Class<T> type) {
            return fastJson.parse(jsonString, type);
        }
    }

}
